﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;


using Business;

namespace GestorEventos
{
    public partial class removePalcoEvento : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["eventID"] != null)
            {
                int eventID = Convert.ToInt32(Request.QueryString["eventID"].ToString());

                ListaPalco business = new ListaPalco();

                ListaPalco listaPalco = new ListaPalco(business.getPalcosEvento(eventID));

                for (int i = 0; i < listaPalco.getListaPalco().Count; i++) {
                    DropDownListPalcos.Items.Add(listaPalco.getListaPalco()[i].getNomePalco());
                }

            }
        }

        public void removerPalco(Object o, EventArgs e)
        {


            if (Request.QueryString["eventID"] != null)
            {
                int eventID = Convert.ToInt32(Request.QueryString["eventID"].ToString());

                String nome = DropDownListPalcos.SelectedValue;


                ListaPalco business = new ListaPalco();
                ListaPalco listaPalcos = new ListaPalco(business.getPalcosEvento(eventID));


                int palcoID = listaPalcos.getPalcoIDByNome(nome);


                Evento evento = new Evento();

                bool value = evento.removePalcoEvento(eventID, palcoID);

                //bool value = evento.insertArtistEvent(eventID, artistaID, data);


                if (value)
                {
                    Label1.Text = "Cenassona";
                }
                if (!value)
                {
                    Label1.Text = "FAILZAO";
                }

            }
        }

    }
}
